﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;

namespace LWrap.CustomLWrapps
{
    public class PorterStemStopAnalyzer:Analyzer
    {
        public static string[] stopWords = { "and","of","the","to","is","their","can","all"};
        public override TokenStream TokenStream(string fieldName, System.IO.TextReader reader)
        {
            Tokenizer tokenizer = new StandardTokenizer(reader);
            TokenFilter lowerCaseFilter = new LowerCaseFilter(tokenizer);
            TokenFilter stopFilter = new StopFilter(lowerCaseFilter, stopWords);
            TokenFilter stemFilter = new PorterStemFilter(stopFilter);
            return stemFilter;
        }
    }
}
